package com.esri.core.internal.tasks.e.a;

import com.esri.core.internal.tasks.TaskListener;
import com.esri.core.io.EsriServiceException;
import com.esri.core.io.UserCredentials;
import java.util.HashMap;
import java.util.Map;

/* loaded from: classes.dex */
public class d extends com.esri.core.internal.tasks.d<byte[]> {
    private static final long serialVersionUID = 1;
    private String a;
    private Map<String, String> b;

    public d(e eVar, String str, UserCredentials userCredentials) {
        this(eVar, str, userCredentials, null);
        if (this.serviceURL.contains("?")) {
            String[] split = this.serviceURL.split("\\?");
            this.a = split[0];
            if (split.length == 2) {
                String[] split2 = split[1].split("&");
                this.b = new HashMap();
                for (String str2 : split2) {
                    String[] split3 = str2.split("=");
                    this.b.put(split3[0], split3.length == 1 ? "" : split3[1]);
                }
            }
        }
    }

    public d(e eVar, String str, UserCredentials userCredentials, TaskListener<byte[]> taskListener) {
        super(eVar, str, userCredentials, taskListener);
        this.a = null;
        this.b = null;
        if (eVar == null) {
            throw new EsriServiceException("The WMS get map task requires input parameters");
        }
        if (!eVar.validate()) {
            throw new EsriServiceException("At least one parameter is missing or incorrect. The parameter might be version number, layer names, spatial reference, bounds, width or height. ");
        }
    }

    @Override // com.esri.core.internal.tasks.a
    /* renamed from: a */
    public byte[] execute() throws Exception {
        Map<String, String> generateRequestParams = this.actionInput.generateRequestParams();
        Map<String, String> map = this.b;
        if (map != null) {
            generateRequestParams.putAll(map);
        }
        String str = this.a;
        if (str == null) {
            str = this.serviceURL;
        }
        return com.esri.core.internal.io.handler.a.a(str, generateRequestParams, getServiceCredentials());
    }
}
